package com.haois.mp.database.module.common.daomain;

import cn.binarywang.wx.miniapp.bean.WxMaUserInfo;
import me.chanjar.weixin.mp.bean.result.WxMpUser;

/**
 * Created by RuiHaoZ on 2018/3/31 22:59
 */
public class WxUser extends WxMpUser {
    public WxUser() {
    }

    public WxUser(WxMpUser wxMpUser) {
        if (wxMpUser == null){
            return;
        }
        this.setOpenId(wxMpUser.getOpenId());
        this.setRemark(wxMpUser.getRemark());
        this.setHeadImgUrl(wxMpUser.getHeadImgUrl());
        this.setLanguage(wxMpUser.getLanguage());
        this.setGroupId(wxMpUser.getGroupId());
        this.setUnionId(wxMpUser.getUnionId());
        this.setSubscribe(wxMpUser.getSubscribe());
        this.setSubscribeTime(wxMpUser.getSubscribeTime());
        this.setNickname(wxMpUser.getNickname());
        this.setSex(wxMpUser.getSex());
        this.setSexDesc(wxMpUser.getSexDesc());
        this.setTagIds(wxMpUser.getTagIds());
        this.setProvince(this.getProvince());
        this.setCity(wxMpUser.getCity());
        this.setCountry(wxMpUser.getCountry());
        this.subscribeState = wxMpUser.getSubscribe() ? "1" : "0";
    }

    public WxUser(WxMaUserInfo wxMaUserInfo) {
        if (wxMaUserInfo == null){
            return;
        }
        this.setOpenId(wxMaUserInfo.getOpenId());
        this.setNickname(wxMaUserInfo.getNickName());
        this.setCity(wxMaUserInfo.getCity());
        this.setProvince(wxMaUserInfo.getProvince());
        this.setCountry(wxMaUserInfo.getCountry());
        this.setHeadImgUrl(wxMaUserInfo.getAvatarUrl());
        this.setUnionId(wxMaUserInfo.getUnionId());
    }

    private String userId;
    private String createTime;
    private String updateTime;
    private String subscribeState;

    public String getSubscribeState() {
        return subscribeState;
    }

    public void setSubscribeState(String subscribeState) {
        this.subscribeState = subscribeState;
    }

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public String getCreateTime() {
        return createTime;
    }

    public void setCreateTime(String createTime) {
        this.createTime = createTime;
    }

    public String getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(String updateTime) {
        this.updateTime = updateTime;
    }
}
